import axios from 'axios';

const service = axios.create({
    // baseURL: 'http://121.36.167.134:8088/wx',
	 baseURL: 'http://127.0.0.1:8088/wx',
	 // baseURL: 'http://192.168.0.100:8088/wx',
    timeout: 5000
});

service.interceptors.request.use(
        config => {
            //在所有请求头部添加token值
            // const token = store.state.token;
            // if (token) {
            //     config.headers.Authorization = token;
            // }
                return config;
            },
            error => {
                console.log(error);
                return Promise.reject();
            }
        );

        service.interceptors.response.use(
            response => {
                if (response.status === 200) {
                    return response.data;
                } else {
                    Promise.reject();
                }
            },
            error => {
                console.log(error);
                return Promise.reject();
            }
        );

        export default service;
